ifndef SystemRoot
MAD= main_ad
endif

#all: PDF_Crack cuda_test passwordlist $(MAD) main_cuda
#all: passwordlist
#all: main_ad
#all: passwordlist main_ad PDF_Crack cuda_rc4
all : cuda_rc4 cuda_test

FLAGS= -Wall -pedantic -std=c99 -Ih -Lsrc
CC= gcc
NVCC= nvcc
ifdef SystemRoot
LIBS= -leay32
else
LIBS= -lcrypto
endif

PDF_Crack: src/main.c
	$(CC) $(FLAGS) -o PDF_Crack src/main.c $(LIBS)

cuda_test: src/cuda_test.cu
	$(NVCC) -I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include" -o cuda_test src/cuda_test.cu -keep
	
passwordlist: src/passwordlist.c
	$(CC) $(FLAGS) -o passwordlist src/passwordlist.c	 

main_ad: src/main_ad.c h/pdf_crack.h
	$(CC) $(FLAGS) -o main_ad src/main_ad.c $(LIBS)

main_cuda: src/main_cuda.cu h/pdf_crack.h
	$(NVCC) -I "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include" -o main_cuda src/main_cuda.cu

cuda_rc4: src/cuda_rc4.cu
	$(NVCC) -o cuda_rc4 src/cuda_rc4.cu
	
.PHONY: clean
clean:
	rm -f PDF_Crack cuda_test passwordlist $(MAD)
